let fn = async ([name, password, captcha], ctx, topic) => {
    let { socket, io, reg, user, WARNING, NOTIFY, USER_INFO } = ctx
    try {
        await reg.users.newUser(user, name, password, socket)
        socket.emit(USER_INFO, user.toSender())
        socket.emit(NOTIFY, { data: `注册成功!` })
        io.emit(NOTIFY, { data: `${user.alias} login` })
    } catch ({ message }) {
        socket.emit(WARNING, { topic, data: `注册失败! ${message}` })
    }
}

module.exports = fn